package cn.com.bluemoon.daps.model.vo;


import cn.com.bluemoon.daps.common.domain.UserPermissionApi;
import cn.com.bluemoon.daps.common.enums.DatabaseType;
import cn.com.bluemoon.daps.model.entity.DapDataModelSubordinateKey;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

@Data
public class InsertModelKeyVo implements UserPermissionApi {


    @ApiModelProperty(value = "索引列表")
    private List<@Valid DapDataModelSubordinateKey> keys;

    @Valid
    @ApiModelProperty(value = "数据库类型 1 mysql,2 pg, 3 hive")
    @NotNull(message = "数据库类型不允许为空")
    private DatabaseType databaseType;

    @Override
    public Serializable getUserPermissionKeyValue() {
        return keys.get(0).getDataModelId();
    }
}
